<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
<#include "head.ftl"/>
</head>
<body>
<div style="width: 200px;">
    <ul class="layui-nav layui-nav-tree layui-nav-side">
    <li class="layui-nav-item layui-nav-itemed">
        <a href="#">实体列表</a>
        <dl class="layui-nav-child">
            <#list entities as item>
                <dd class="${(entityId==item.id)?string('layui-this','')}"><a href="/entity?entityId=${item.id}">${item.tableName}</a></dd>
            <#else>
                <dd>无记录</dd>
            </#list>
        </dl>
    </li>

    </ul>
</div>
<div style="margin-left: 200px;">
    <div class="layui-colla-content layui-show layui-form">
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input type="text" value="${module!}" name="module" placeholder="请输入模块名" class="layui-input"/>
                <input type="hidden" value="${entityId!}" name="entityId"/>
            </div>
        </div>
    </div>
    <#list entityFields as item>
        <div class="layui-collapse" id="field_${item.id}" data-id="${item.id}">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">
                    <div class="layui-row">
                        <div class="layui-col-md2">
                            ${item.columnEx}
                        </div>
                        <div class="layui-col-md8">
                            &nbsp;${item.commentEx}
                        </div>
                        <div class="layui-col-md2">
                            ${(item.primaryEx! == '1')?string('主键','&nbsp;')}
                        </div>
                    </div>
                </h2>
                <div class="layui-colla-content layui-show layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-inline" style="width: 80px;">
                            <input type="checkbox" ${(item.ignoreEx! == '1')?string('','checked=true')}" name="ignoreEx" lay-skin="switch" lay-text="启用|忽略">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" value="${item.field}" name="field" placeholder="请输入字段名" class="layui-input"/>
                        </div>
                        <div class="layui-input-inline" >
                            <input type="text" value="${item.nameEx}" name="nameEx" placeholder="请输入中文名" class="layui-input"/>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" value="${item.fieldType}" name="fieldType" placeholder="请输入java类型" class="layui-input"/>
                        </div>
                        <#--<div class="layui-input-inline">
                            <select name="validateRule">
                                <option value="">校验规则(无)</option>
                            </select>
                        </div>-->
                        <div class="layui-input-inline" style="width: 80px;">
                            <input type="checkbox" ${(item.required! == '1')?string('checked=true','')}" name="required" title="必填"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </#list>
    <div class="layui-form-item button-block">
        <button class="layui-btn" id="saveBtn" lay-submit>保存</button>
    </div>
</div>
<script type="text/javascript" src="/js/entity.js"></script>
</body>
</html>